import request from '@/utils/request'
import { helper } from 'echarts'

// 查询partyclass列表
export function listPartyclass(query) {
  return request({
    url: '/partyclass/partyclass/list',
    method: 'get',
    params: query
  })
}

// 查询partyclass详细
export function getPartyclass(id) {
  return request({
    url: '/partyclass/partyclass/' + id,
    method: 'get'
  })
}

// 根据视频栏目查询数据
export function listByVideoType(type) {
  return request({
    url: `/partyclass/partyclass/listByVideoType/${type}`,
    method: 'get'
  })
}

// 新增partyclass
export function addPartyclass(data) {
  return request({
    url: '/partyclass/partyclass/add',
    method: 'post',
    data: data,
    headers:{
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 修改
export function updatePartyclass(id, data) {
  return request({
    url: `/partyclass/partyclass/update/${id}`,
    method: 'put',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 交换两个partyclass的排序值
export function updatePartyclassSortOrder(id1, id2) {
  return request({
    url: '/partyclass/partyclass/swapSortOrder',
    method: 'put',
    data: {
      id1: id1,
      id2: id2
    }
  })
}

// 上移
export function moveUp(id) {
  return request({
    url: `/partyclass/partyclass/moveUp/${id}`,
    method: 'put'
  })
}

// 下移
export function moveDown(id) {
  return request({
    url: `/partyclass/partyclass/moveDown/${id}`,
    method: 'put'
  })
}

// 移至顶部
export function moveToTop(id) {
  return request({
    url: `/partyclass/partyclass/moveToTop/${id}`,
    method: 'put'
  })
}

// 删除partyclass
export function delPartyclass(id) {
  return request({
    url: '/partyclass/partyclass/' + id,
    method: 'delete'
  })
}

// 删除partyclass
export function publishPartyVideo(id) {
  return request({
    url: '/partyclass/partyclass/publish/' + id,
    method: 'put'
  })
}
